#ifndef __VEREMA_GRAPHICSVIEW_H__
#define __VEREMA_GRAPHICSVIEW_H__

#include <QtCore/QObject>
#include <QtGui/QWidget>
#include <QtGui/QGraphicsView>
#include <QtCore/QEvent>
#include <QtGui/QMouseEvent>

namespace verema {

/**
 * \brief class containing the extended implementation of QGraphicsview to emit a lost focus signal
 */
class GraphicsView : public QGraphicsView {

    Q_OBJECT

public:
    /**
     * \brief constructor
     */
    GraphicsView( QWidget *parent) : QGraphicsView(parent)
    {
        setAttribute(Qt::WA_Hover, true);
    }

    /**
     * \brief reimplementation for lost focus event to emit signal
     */
    void focusOutEvent(QFocusEvent * e)
    {
        // e usage to kill the "unused parameter" warning
        if(e == e) emit lostFocus();

    }

    void leaveEvent(QEvent *e)
    {
        // e usage to kill the "unused parameter" warning
        if(e == e) emit leaveView();

    }

signals:

    /**
     * \brief signal emitted on losing focus
     */
    void lostFocus();



    /**
     * \brief signal emitted when leaving view
     */
    void leaveView();
};

}// namespace verema

#endif //__VEREMA_GRAPHICSVIEW_H__
